<!--
 * @Author: 45F
 * @LastEditors: 45F
 * @Description: 案事件管理_案事件详情_任务详情_流程详情
 * @Date: 2019-07-29 17:16:47
 * @LastEditTime: 2019-08-01 11:37:02
 -->
<template>
  <div style="padding: 32px; background-color: #fff;">
    <a-steps direction="vertical" style="margin: 0 auto; width: 300px;" :current="1">
      <a-step v-for="(item, index) in list" :key="index" :title="item.nodeName" :status="setStatus(item.status)">
        <a-icon
          v-if="item.recordType === 2"
          type="exclamation-circle"
          slot="icon"
          :style="{ color: '#FE6601', fontSize: '32px' }"
        />
        <div class="font-gray" slot="description">
          <p>姓名：{{ item.approverName }}</p>
          <p v-if="item.status === null">操作：{{ recordType[item.recordType] }}</p>
          <template v-else>
            <p>审批结果：{{ item.statusName }}</p>
            <p>审批意见：{{ item.remark }}</p>
          </template>
          <p v-if="item.status === null">发起时间：{{ item.createTime }}</p>
          <p v-else>审批时间：{{ item.approverTime }}</p>
        </div>
      </a-step>
    </a-steps>
  </div>
</template>

<script>

export default {
  data() {
    return {
      getPars: {
        taskId: this.$route.params.id
      },
      list: [],
      recordType: {
        0: '发起',
        1: '审批',
        2: '撤销'
      }
    }
  },
  mounted() {
    this.getDetails()
  },
  methods: {
    getDetails() {
      this.list = [
        {
          nodeName: '发起人',
          recordType: 0,
          status: null,
          statusName: '发起',
          approverName: 'JD测试',
          user: {
            id: 199,
            userName: 'JD测试',
            fullName: 'JD测试',
            phone: '8613078928687',
            duties: null,
            policeCode: '11111111',
            unitId: 813,
            unitName: null,
            createTime: 1571471857000,
            createUser: 97,
            createUserName: null,
            status: 0,
            departments: [{ depId: 167, depName: '禁毒支队', deptType: 5 }],
            roleList: [
              {
                id: 44,
                name: '警员',
                description: null,
                unitId: 813,
                status: 0,
                createTime: 1567515019000,
                createUser: 97,
                updateTime: 1622422301000,
                updateUser: 97
              }
            ],
            cardId: null
          },
          remark: null,
          approverTime: null,
          createTime: 1648713010000
        },
        {
          nodeName: '第1级审批',
          recordType: 1,
          status: 1,
          statusName: '审批中',
          approverName: '中信达测试',
          user: {
            id: 853,
            userName: 'test001',
            fullName: '中信达测试',
            phone: '8617788800001',
            duties: '测试',
            policeCode: '1002',
            unitId: 813,
            unitName: null,
            createTime: 1642406243000,
            createUser: 97,
            createUserName: null,
            status: 0,
            departments: [{ depId: 167, depName: '禁毒支队', deptType: 5 }],
            roleList: [
              {
                id: 156,
                name: 'test2',
                description: '11',
                unitId: 813,
                status: 0,
                createTime: 1642668067000,
                createUser: 97,
                updateTime: null,
                updateUser: null
              }
            ],
            cardId: '11'
          },
          remark: null,
          approverTime: null,
          createTime: 1648713010000
        },
        {
          nodeName: '第2级审批',
          recordType: 1,
          status: 0,
          statusName: '未审批',
          approverName: '后台管理员',
          user: {
            id: 97,
            userName: '长春市公安局',
            fullName: '后台管理员',
            phone: null,
            duties: '后台管理员',
            policeCode: null,
            unitId: 813,
            unitName: null,
            createTime: 1566895351000,
            createUser: 1,
            createUserName: null,
            status: 0,
            departments: [],
            roleList: [],
            cardId: null
          },
          remark: null,
          approverTime: null,
          createTime: 1648713010000
        }
      ]
    },
    setStatus(value) {
      // 0：未审批，1：待审批，2：通过，3：驳回
      if (value === 1) {
        return 'process'
      } else if (value === 2) {
        return 'finish'
      } else if (value === 3) {
        return 'error'
      }
    }
  }
}
</script>
